package com.djnt.catering.database;

import java.util.HashMap;

import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.provider.BaseColumns;

public class HotNews implements BaseColumns {

	static final String TABLE_NAME = "hotnews";

	/**
	 * The content:// style URL for this table
	 */
	public static final Uri CONTENT_URI = Uri.parse("content://"
			+ CateringProvider.AUTHORITY + "/" + TABLE_NAME);

	public static class Status {
		public static final int Draft = 0;
		public static final int SentBox = 1;
	}

	static final String LOGO = "logo";
	public static final String NAME = "name";
	public static final String BODY = "body";
	public static final String DATE = "date";
	public static final String CAPTION = "caption";
	public static final String VISIT = "visit";
	public static final String PHONE = "phone";
	public static final String EMAIL = "email";
	public static final String STATUS = "status";
	public static final String DEFAULT_SORT_ORDER = DATE + " DESC";

	public static void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
				+ " INTEGER PRIMARY KEY," + NAME + " TEXT," + DATE
				+ " INTEGER,  " + BODY + " TEXT," + CAPTION + " TEXT," + LOGO
				+ " TEXT," + VISIT + " INTEGER," + STATUS + " INTEGER," + PHONE
				+ " TEXT," + EMAIL + " TEXT" + ");");
	}

	public static HashMap<String, String> PROJECTION_MAP = new HashMap<String, String>();
	static {
		PROJECTION_MAP.put(_ID, _ID);
		PROJECTION_MAP.put(NAME, NAME);
		PROJECTION_MAP.put(LOGO, LOGO);
		PROJECTION_MAP.put(BODY, BODY);
		PROJECTION_MAP.put(DATE, DATE);
		PROJECTION_MAP.put(CAPTION, CAPTION);
		PROJECTION_MAP.put(VISIT, VISIT);
		PROJECTION_MAP.put(PHONE, PHONE);
		PROJECTION_MAP.put(EMAIL, EMAIL);
		PROJECTION_MAP.put(STATUS, STATUS);
		UriMatcherCode.addURI(TABLE_NAME, UriMatcherCode.HOTNEWS);
		UriMatcherCode.addURI(TABLE_NAME + "/#", UriMatcherCode.HOTNEWS_ID);
	}
}
